<%@page import="java.util.HashMap"%>
<%@page import="java.util.ArrayList,com.ericsson.mna.model.pojo.*"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>View Task</title>
<link rel="stylesheet" type="text/css" href="commonStyle.css">

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.5/css/jquery.dataTables.css">
<script type="text/javascript" type="text/javascript" src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript" type="text/javascript" src="/path/to/jquery.tablesorter.js"></script>
<script type="text/javascript" type="text/javascript" src ="https://cdn.datatables.net/1.10.5/js/jquery.dataTables.min.js"></script>

<script type="text/javascript">

$(document).ready(function() {
    $('#example').dataTable( {
        "order": [[ 3, "desc" ]]
    } );
} );
</script>


</head>
<body>

<%@ include file="header.jsp" %>
<div id="nav">

</div>
 <form action="taskAction.do" method="post">
 <input type="hidden" name="pageName" value="updateTaskStatus">
<div id="section">
<h3 align="justify" >View Task Status</h3>
<table id="example" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>Task Id</th>
			    <th>Task Name</th>
			    <th>Target Date</th>
			    <th>Completion Date</th>
			    <th>Priority</th>
			    <th>Current Status</th>
			    <th>Take Action</th>

            </tr>
        </thead>



        <tbody>

 			 <% int i=0;
 			 ArrayList<Task> taskList=(ArrayList<Task>)request.getAttribute("taskList");
 			session.setAttribute("totalTask", taskList.size());
     System.out.println("From ViewTaskJsp" + taskList);
  for(Task t:taskList){%>
  <tr>
    <td><a href= "taskAction.do?taskId=<%=t.getTask_Id()%>" > <%=t.getTask_Id() %> </a></td>
     <input type="hidden" name="taskName<%=i %>" value="<%=t.getTask_Id()%>">

    <td><%=t.getTask_Description() %></td>
    <td><%=t.getTask_End_Date() %></td>
    <td><%=t.getTask_Completed_On() %></td>
    <td><%=t.getPriority() %></td>
    <td><%=t.getStatus() %></td>
    <td><input type="radio" name="action<%=i %>" value="close" >Close</input>
    	<input type="radio" name="action<%=i %>" value="ReOpen" >Re-Open</input>
    </td>
  </tr>



<% i++;} %>



        </tbody>
        <tr><td align="left"><input type="submit" value="Update Task Status" class="btn"></td><td></td></tr>
    </table>
    </div>
    </form>
<%@ include file="footer.jsp" %>
</body>
</html>
